package com.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.aop.aspectj.SingletonAspectInstanceFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import javax.annotation.Resource;


@Lazy(value=false)
@Data
@AllArgsConstructor
@NoArgsConstructor

public class Person {
    private String name;
    private String gender;
    private int age;
    //根据类型自动注入car对象
    @Autowired
   // @Qualifier("car2")
    //与Car类中的Component相对应
    @Resource(name="car2")
    private Car car;

    //创建initMethod属性的方法，在bean被实例化时被执行
    public static void  initPerson(){
       System.out.println(" initMethod()....");
    }
    //创建一个destoyMethod属性方法，当bean被移除时，执行
    public static void destoryPerson(){
        System.out.println("destoryMethod..." );
    }

}
